<template>
	<view class="container">
		<template v-if="Lat>0">
		<view class="address">地址：{{Address}}</view>
		<view class="btn" @click="Back">请返回电脑端查看</view>
		</template>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				ID:'',
				Lat:0,
				Lng:0,
				Name:'',				
				Address:'',
			};
		},
		onLoad(options) {
			this.ID=options.scene;
			uni.chooseLocation({
				success:res=> {
					this.Lat = res.latitude;
					this.Lng = res.longitude;
					this.Address = res.name+"（"+res.address+"）";
					this.Upload_ActiveAddress();
				},
				fail:res=>{
					this.Address="（）";
				}
			});
		},
		methods:{
			Back(){
				if(this.Address=="（）"){
					this.Util.Alert("请选择活动地点");
				}else{
					uni.navigateBack();
				}
			},
			Upload_ActiveAddress(){
				if(this.Address=="（）"){
					this.Util.Alert("请选择活动地点");
				}else{
					var data = {};
					data.Act="Upload_ActiveAddress";
					data.ID=this.ID;
					data.Lat=this.Lat;
					data.Lng=this.Lng;
					data.Address=this.Address;
					this.Util.Loading("正在上传位置信息...");
					this.Util.Post(data, json=>{
						this.Util.HideLoading();
						this.Util.Toast("上传位置信息成功");
					});
				}
			}
		}
	}
</script>

<style lang="scss">
	.container{
		.address{width:100%; height:auto; line-height: 50rpx; font-size:34rpx; padding:30rpx; padding-top:100rpx;}
		.btn{ width:710rpx; margin-left:20rpx; margin-top:140rpx; margin-bottom: 20rpx; height:90rpx; line-height: 90rpx; border-radius:45rpx;  background-color: #d13c13; color:#ffffff; text-align: center; font-size:36rpx;}
	}
</style>
